package bz.yfw.example.s3blazeds.part1.view
{
	import bz.yfw.example.s3blazeds.part1.view.state.ViewState;
	import bz.yfw.example.s3blazeds.part1.view.state.ViewState;
	
	import mx.states.Transition;
	
	import org.seasar.akabana.yui.framework.ns.viewlogic;
	import org.seasar.akabana.yui.framework.ns.viewpart;
	
	import spark.components.BorderContainer;
	import spark.components.BusyIndicator;
	import spark.components.Button;
	import spark.components.Group;
	import spark.components.HGroup;
	import spark.components.Label;
	import spark.components.NavigatorContent;
	import spark.components.Panel;
	import spark.components.RadioButton;
	import spark.components.RadioButtonGroup;
	import spark.components.TextInput;
	import spark.components.View;
	import spark.components.ViewNavigator;
	import spark.effects.Fade;
	
	use namespace viewlogic;
	
	public class TopView extends View
	{
		[SkinPart]
		public var grpMainState:Group;
		
		[SkinPart]
		public var txtinptText:TextInput;
		
		[SkinPart]
		public var rdoBtnPing:RadioButton;
		
		[SkinPart]
		public var rdoBtnToroku:RadioButton;
		
		[SkinPart]
		public var rdoBtnShutoku:RadioButton;
		
		[SkinPart]
		public var btnSend:Button;
		
		[SkinPart]
		public var lblResult:Label;
		
		[SkinPart]
		public var lblMessage:Label;
		
		public var btnExit:Button;
		
		public var bsindctrSendWait:BusyIndicator;
		
		public var rdBtnGrup:RadioButtonGroup;
		
		private var requiredCurrentState:String;
		
		public function TopView() {
			super.title = "Yui Sample App";
			rdBtnGrup = new RadioButtonGroup();
			createNavigationContent();
			createActionContent();
		}
		
		protected override function getCurrentSkinState():String{
			if(requiredCurrentState == null){
				return ViewState.NORMAL_STATE;
			}
			return requiredCurrentState;
		}
		
		viewlogic function editState(
			message:String, edit:Boolean = true):void {
			
			bsindctrSendWait.visible = !edit;
			lblMessage.text = message;
			enabled = edit;
		}
		
		private function createNavigationContent():void {
			bsindctrSendWait = new BusyIndicator();
			bsindctrSendWait.setStyle("symbolColor", 0xffffff);
			navigationContent = [bsindctrSendWait];
			
			bsindctrSendWait.visible = false;
		}
		
		private function createActionContent():void {
			btnExit = new Button();
			btnExit.label = "終了";
			
			actionContent = [btnExit];
		}
	}
}